package RTL.Task3;

//实现通话套餐
public class TalkPackageServiceImpl extends Package implements TalkService {
    // 1.私有化变量
    private int talkTime;
    private int msgCount;

    // 调用set方法
    public TalkPackageServiceImpl() {
    }
    public TalkPackageServiceImpl(double rate, int talkTime, int msgNumber) {
        super(rate);
        setTalkTime(talkTime);
        setMsgNumber(msgNumber);
    }

    // get 和set并进行判断
    public int getTalkTime() {
        return talkTime;
    }

    public void setTalkTime(int talkTime) {
        this.talkTime = talkTime;
    }

    public int getMsgNumber() {
        return msgCount;
    }

    public void setMsgNumber(int msgNumber) {
        if (msgNumber >= 0) {
            this.msgCount = msgNumber;
        } else {
            System.out.println("短信不得为负数！");
        }
    }

    // 4.显示所有套餐信息
    @Override
    public void show() {
        System.out.println("通话时间为: " + getTalkTime() + "分钟，短信条数为: " + getMsgNumber() +" 月费为: " + getRate() + "元");
    }

    @Override
    public void talk(int talkTime, PhoneCard phoneCard) {
        System.out.println("通话信息");
    }
}
